<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        textarea{width: 400px;height: 500px;}
    </style>
</head>
<body>
    <textarea name="!@#$%^&*(" id="txt1" title="这是一个title"></textarea>
    <input type="button" value="转换" id="btn">
    <textarea name="" id="txt2" ></textarea>
</body>
<script>
    var otxt1 = document.getElementById("txt1")
    var otxt2 = document.getElementById("txt2")
    var obtn = document.getElementById("btn")

    obtn.onclick = function(){

        // 通配符的贪婪特性：尽可能的多匹配
        // var reg = /<.+>/g;

        // 简易html标签正则
        // 只适合做替换
        // 不适合做验证
        var reg1 = /<[^>]+>/g;
        var s1 = otxt1.value.replace(reg1,"\n");

        var reg2 = /\s+/g;
        var s2 = s1.replace(reg2,"\n");

        var reg3 = /(\.\s)+/g;
        otxt2.value = s2.replace(reg3,".");
        
    }

</script>
</html>